#include "common.h"
VOID ServerManager()
{
   MESSAGE message;
   SIGNAL  signal;
   signal.sourcepid=DRIVERMANAGER;
   signal.signal=SIGNAL_ANY;
   signal.dt=0;
   WaitSignal(&signal);
/*--------------------------MMServer--------------------------------*/
   InitKernelPCB(MMSERVER,(PVOID)GetPhysicalAddress(MMServer),(0x200000-0x4000*MMSERVER),10,"MMServer",NULL,NULL);
   ActivateProcess(&kernelprocess[MMSERVER]);
   message.destination=MMSERVER;
   message.type=MMSERVER_WHOIAM;
   SendMessage(&message);
/*-------------------------FSServer---------------------------------*/
   InitKernelPCB(FSSERVER,(PVOID)GetPhysicalAddress(FSServer),(0x200000-0x4000*FSSERVER),10,"FSServer",NULL,NULL);
   ActivateProcess(&kernelprocess[FSSERVER]);
   message.destination=FSSERVER;
   message.type=FSSERVER_WHOIAM;
   SendMessage(&message);
/*------------------------------------------------------------------*/
   signal.dt=AFFAIRMANAGER;
   signal.signal=SIGNAL_ANY;
   signal.returnvalue=0;
   NotifyWaited(&signal);


   while(1)
   {
    if(ReceiveMessage(&message)!=ARTIST_ERROR_OK)continue;
     switch(message.type)
     {
       case SERVERMANAGER_WHOIAM:
       {
        //  Print("\n");
          Print("ServerManager begin...\n");

          break;
       }
       case SERVERMANAGER_MMSERVER:
       {
          InitKernelPCB(MMSERVER,(PVOID)GetPhysicalAddress(MMServer),(0x200000-0x4000*MMSERVER),10,"MMServer",NULL,NULL);
          ActivateProcess(&kernelprocess[MMSERVER]);
          message.destination=MMSERVER;
          message.type=MMSERVER_WHOIAM;
          SendMessage(&message);
          break;
       }
       case SERVERMANAGER_FSSERVER:
       {
          InitKernelPCB(FSSERVER,(PVOID)GetPhysicalAddress(FSServer),(0x200000-0x4000*FSSERVER),10,"FSServer",NULL,NULL);
          ActivateProcess(&kernelprocess[FSSERVER]);
          message.destination=FSSERVER;
          message.type=FSSERVER_WHOIAM;
          SendMessage(&message);
          break;
       }
     }
   }
}
